package com.tywj.panda.pay

import android.widget.ImageView
import com.tywj.panda.customer.common.widget.recyclerview.MyBaseAdapter
import com.tywj.panda.pay.entity.PayTypeEntity
import com.tywj.lib.core.common.extension.load
import com.tywj.lib.core.widget.recycleview.adapter.BaseViewHolder

/**
 * <pre>
 *     author : June Yang
 *     time   : 2020/5/25
 *     desc   : 支付方式选择
 *     version: 2.0.0
 * </pre>
 */
class PayChooseAdapter : MyBaseAdapter<PayTypeEntity>(R.layout.pay_choose_item) {

    override fun convert(helper: BaseViewHolder, item: PayTypeEntity) {
        super.convert(helper, item)

        helper.getView<ImageView>(R.id.ivPayType).load(item.resDrawableId)
        helper.setText(R.id.tvPayName, item.payStyle)

        if (item.isSelected)
            helper.setImageResource(R.id.ivSelected, R.drawable.common_rb_oval_checked)
        else {
            helper.setImageResource(R.id.ivSelected, R.drawable.common_rb_oval_normal)
        }
    }
}